<template>
    <P>Home</P>
    <button @click="pushStr">字符串跳转</button><br>
    <button @click="pathPush">路径跳转</button><br>
    <button @click="pushName">名称跳转</button>
    <button @click="pushPathQuery">push-名字路径传参</button>
</template>

<script setup>
    import {onMounted} from 'vue'
    import {useRoute,useRouter} from 'vue-router'
    const route = useRoute()
    const router = useRouter()
    const pushStr=()=>{
        router.push('/about')
    }
    const pathPush=()=>{
        router.push({path:'/about'})
    }
    const pushName = ()=>{
        route.push({name:'about'})
    }
    const pushPathQuery=()=>{
        router.push({path:'/about',query:{name:'tom'}})
    }
</script>